package com.shaozi.nc.hibservice;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shaozi.data.hib.common.Hql;
import com.shaozi.data.hib.common.Where;
import com.shaozi.data.hib.dao.BaseHibDao;
import com.shaozi.data.hib.service.BaseServiceImpl;
import com.shaozi.lib.throwable.SzException;
import com.shaozi.nc.data.hibVO.AttendanceLevelVO;

@Service(value = "attendanceLevelService")
public class AttendanceLevelService extends BaseServiceImpl<AttendanceLevelVO> {

	@Autowired
	public AttendanceLevelService(BaseHibDao<AttendanceLevelVO> baseHibDao) {
		super(baseHibDao);
	}

	public List<AttendanceLevelVO> loadList(String companyId) throws SzException {
		String hql = "from AttendanceLevelVO where isDelete=0 and companyId=" + companyId;
		return getDao().getDaoSupport().queryObjects(hql, -1, -1);
	}
	
	public List<AttendanceLevelVO> loadList(Integer ruleId) throws SzException{
		Hql hql = Hql.get("from AttendanceLevelVO");
		Where where = Where.getWhere().eq("isDelete", 0).eq("ruleId",ruleId);
		hql.add(where);
		return getDao().getDaoSupport().queryObjects(hql, -1, -1);
	}

}
